import React from 'react'
import { FlatList, StyleSheet, TouchableOpacity, Text, Button, View, Image, ImageBackground, ScrollView, Dimensions } from 'react-native';
import { AntDesign } from '@expo/vector-icons';
import { Entypo } from '@expo/vector-icons';
import { useAuth } from '../../context/AuthProvider';
import AsyncStorage from '@react-native-async-storage/async-storage';
const Btn = ({ style, children, ...rest }) => {
    return <TouchableOpacity {...rest}
        style={{ borderRadius: 10, justifyContent: 'center', alignItems: 'center', ...style }}>
        <Text style={{ color: 'white' }}>{children}</Text>
    </TouchableOpacity>
}
const Setting = ({ navigation }) => {
    const { user, delUser, setUser } = useAuth()
    const clear = ()=>{
        // AsyncStorage.removeItem('mycropsid')
        setUser({})
        delUser()
    }
    return (
        <View>
            <View style={{width: '100%',height: '90%'}}>
                <TouchableOpacity style={styles.miniCon} onPress={() => navigation.navigate('advice')} activeOpacity={0.6}>
                    <View style={{ flexDirection: 'row', alignItems: 'center' }}>
                        <Text style={{ marginLeft: '8%' }}>问题反馈</Text>
                    </View>
                </TouchableOpacity>
                <TouchableOpacity style={styles.miniCon} onPress={() => navigation.navigate('withus')} activeOpacity={0.6}>
                    <View style={{ flexDirection: 'row', alignItems: 'center' }}>
                        <Text style={{ marginLeft: '8%' }}>关于我们</Text>
                    </View>
                </TouchableOpacity>
                {/* <TouchableOpacity style={styles.miniCon} onPress={clear} activeOpacity={0.6}>
                    <View style={{ flexDirection: 'row', alignItems: 'center' }}>
                        <Text style={{ marginLeft: '8%' }}>清除缓存</Text>
                    </View>
                </TouchableOpacity> */}
            </View>
            <View style={{alignItems: 'center', bottom: 0, }}>
                <Btn style={{backgroundColor:'#A0D377', padding: 5, width: '50%', justifyContent: 'center'}} onPress={()=>clear()}>退出登录</Btn>
            </View>
        </View>
    )
}
const styles = StyleSheet.create({
    miniCon: {
        backgroundColor: '#fff',
        marginLeft: '5%',
        marginRight: '5%',
        borderColor: '#BBBBBB',
        borderWidth: 0.5,
        alignItems: 'center',
        padding: '3%',
        justifyContent: 'space-between',
        flexDirection: 'row',
    },
    miniCon1: {
        marginTop: '5%'
    },
});
export default Setting